<div class="infoBlock">
<div class="infoBlockHeading"><span class="t">Link</span></div>
<div class="infoBlockContent">

<div class="infoBlockItem">
<form name="listform" method="post">
<input type="hidden" name="action" value="updatelink">
<table width="100%" border="0" cellspacing="0" cellpadding="5" class="listBox">
  <tr class="listBoxHeading">
    <td>{pp_inputcheckboxall name="sla" values=""}</td>
    <td>Name</td>
    <td>Link</td>
    <td>Action</td>
  </tr>
{section name=item loop=$CONTENT.items}
  <tr>
    <td>{pp_inputcheckbox value=$CONTENT.items[item].id}</td>
    <td>{$CONTENT.items[item].name_prefix}{$CONTENT.items[item].name}</td>
    <td>{pp_inputtext name="field_link[]" eid=$CONTENT.items[item].id value=$CONTENT.items[item].link}</td>
    <td><a href="?op=edit&id={$CONTENT.items[item].id}">Edit</a>&nbsp;<a href="javascript:void(0);" onclick="PJS.list.delchkgo('?op=dodelete&id={$CONTENT.items[item].id}');">Delete</a></td>
  </tr>
{sectionelse}
  <tr>
    <td colspan="8"></td>
  </tr>
{/section}
  <tr>
    <td colspan="2"></td>
    <td><input type="submit" name="submitbtn" class="sbm" value="Update"></td>
    <td colspan="1"></td>
  </tr>
  <tr class="listBoxActionB">
    <td colspan="8"><div id="tocid" class="part"><input type="button" name="move" value=" Move To " onclick="return PJS.list.doActionCheck('moveitems', this);return false;"> {pp_inputoptions name="tocid" options=$CONTENT.categories_options style="-----Categories-----" class="pclw" onchange="PJS.list.doActionCheck('moveitems', this);"}</div><div id="sfd" class="part">{pp_inputoptions name="field" options="[-----Actions-----=|Delete=delete|Status open=statusopen|Status close=statusclose]" onchange="PJS.list.doActionField('setfield', this);"}</div></td>
  </tr>
</table>

{if $CONTENT.navigation.show == 1}
<div class="navigation">
<span class="count">{$CONTENT.navigation.count}</span>
<span class="links"><ul>{$CONTENT.navigation.links}</ul></span>
</div>
{/if}
</form>
</div>

<script type="text/javascript" language="javascript" src="{$CONTEXT.URL}js/pjs.xh.js"></script>
{literal}
<script type="text/javascript" language="javascript">
var json_url=PJS.BASE_URL+"api/link";
function _check_link(evt){
	var el = PJS.srcElement(evt);
	var l = el.value;
	var k = el.name.substring("field_link[a".length).substr(1,-1);
	var url=json_url;
	var params=[];
	params['action']='check';
	params['link']=l;
	params['key']=k;
	//pjs_xh.json(url,params,_check_link_cb);
}
function _check_link_cb(r){
	alert(r.status);
}
function _listen_link(){
  var a = PJS.getElements(document.listform,"INPUT","");
  for(var i=0; i<a.length; i++){
	if(a[i].name.indexOf("field_link")>-1){
	  PJS.addEvent(a[i],"blur",function(event){_check_link(event);});
	}
  }
}
PJS.addLoadEvent(_listen_link);
</script>
{/literal}

</div>
</div>